package com.jl.sms.cdma;

public class TeleserviceIdentifier implements Parameter {

	public static final byte ID = 0x00;

	private int teleID;

	public TeleserviceIdentifier(int id) {
		this.teleID = id & 0xFFFF;
	}

	public TeleserviceIdentifier(byte[] value) {
		this((value[2] << 8) | value[3]);
	}

	@Override
	public byte getID() {
		return ID;
	}

	@Override
	public byte[] getData() {
		byte[] data = new byte[2];
		data[0] = (byte) (teleID >> 8);
		data[1] = (byte) (teleID & 0xFF);
		return data;
	}

	@Override
	public byte[] value() {
		byte[] all = new byte[4];
		all[0] = ID;
		all[1] = 2;
		byte[] temp = getData();
		all[2] = temp[0];
		all[3] = temp[1];
		return all;
	}

	@Override
	public String valueAsString() {
		String res = "";
		switch (teleID) {
		case CDMA.TELESERVICE_CMT_91:
			res = "IS-91 Extended Protocol Enhanced Services";
			break;
		case CDMA.TELESERVICE_CMT_95:
			res = "Wireless Messaging Teleservice";
			break;
		case CDMA.TELESERVICE_CPT_95:
			res = "Wireless Paging Teleservice";
			break;
		case CDMA.TELESERVICE_VMN_95:
			res = "Voice Mail Notification";
			break;
		default:
			break;
		}
		return res;
	}
}
